//
//  BaseAnchorViewModel.swift
//  DouYuZB
//
//  Created by 中创 on 2020/4/24.
//  Copyright © 2020 梁森. All rights reserved.
//

import UIKit

class BaseAnchorViewModel {

    /// 所有的组
    var anchorGroups:[AnchorGroup] = []
    func requestData(url:String, parameters:[String:Any], finishCallback:@escaping()->()) {
        NetworkTool.requestData(url: url, params: parameters, method: .GET, success: { (response) in
            guard let responseDict = response as? [String:NSObject] else{return}
            guard let dataArray = responseDict["data"] as? [[String:NSObject]] else{return}
            for dict in dataArray{
                let model = AnchorGroup.deserialize(from: dict)
                model!.icon_name = "home_header_normal"
                self.anchorGroups.append(model!)
            }
            finishCallback()
        }) { (response) in
            
        }
    }
}
